package com.kgc.service.impl;

import com.kgc.dao.TicketTypeMapper;
import com.kgc.pojo.TicketType;
import com.kgc.service.TicketTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;

@Service
public class TicketTypeServiceImpl implements TicketTypeService {
    @Autowired
    private TicketTypeMapper ticketTypeMapper;

    @Override
    @CacheEvict(value = "ticketType", allEntries = true)
    public void addTicketCount(Integer tickettypeid, Integer ordercounts) {
        TicketType ticketType = ticketTypeMapper.selectByPrimaryKey(tickettypeid);
        int updCount = ticketType.getCount()+ordercounts;
        ticketType.setCount(updCount);
        ticketTypeMapper.updateByPrimaryKeySelective(ticketType);
    }
}
